<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>

<form action="<?php echo url_for('users/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id_user='.$form->getObject()->getIdUser() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
 <?php echo $form->renderGlobalErrors() ?>
<span class="nombre-campo">First Name<?php echo $form['name']->renderError() ?>
          <?php echo $form['name'] ?></span><br />
          <span class="nombre-campo"><?php echo $form['last_name']->renderLabel() ?><?php echo $form['last_name']->renderError() ?>
          <?php echo $form['last_name'] ?></span><br />
          <span class="nombre-campo"><?php echo $form['login']->renderLabel() ?> <?php echo $form['login']->renderError() ?>
          <?php echo $form['login'] ?></span><br />
          <span class="nombre-campo"><?php echo $form['password']->renderLabel() ?> <?php echo $form['password']->renderError() ?>
          <?php echo $form['password'] ?></span><br />
          <span class="nombre-campo"><?php echo $form['email']->renderLabel() ?><?php echo $form['email']->renderError() ?>
          <?php echo $form['email'] ?></span><br />
          <span class="nombre-campo"><?php echo $form['mobile']->renderLabel() ?><?php echo $form['mobile']->renderError() ?>
          <?php echo $form['mobile'] ?></span><br />
           <span class="nombre-campo"><?php echo $form['phone']->renderLabel() ?><?php echo $form['phone']->renderError() ?>
          <?php echo $form['phone'] ?></span><br />
            <?php if ($sf_user->hasCredential('Admin')) : ?><span class="nombre-campo"><?php echo $form['credential']->renderLabel() ?> <?php echo $form['credential']->renderError() ?>
          <?php echo $form['credential'] ?></span><br />
          <span class="nombre-campo"><?php echo $form['id_account']->renderLabel() ?><?php echo $form['id_account']->renderError() ?>
          <?php echo $form['id_account'] ?></span>
           <?php else : ?>
      <input type="hidden" name="user[credential]" id="user_credential" value="3" />
      <input type="hidden" name="user[id_account]" id="user_id_account" value="<?php echo $sf_user->getAttribute('id_account') ?>" />
      <?php endif; ?>
<br />
          <?php echo $form->renderHiddenFields(false) ?>
          &nbsp;<a href="<?php echo url_for('users/index') ?>">Back to list</a>
          <?php if (!$form->getObject()->isNew()): ?>
            &nbsp;<?php echo link_to('Delete', 'users/delete?id_user='.$form->getObject()->getIdUser(), array('method' => 'delete', 'confirm' => 'Are you sure?')) ?>
          <?php endif; ?>
          <input type="submit" value="Save" class="button-enter" />
   
</form>
